<?php
/**
 * The html template file of index method of index module of zentaoPHP.
 *
 * The author disclaims copyright to this source code.  In place of
 * a legal notice, here is a blessing:
 * 
 *  May you do good and not evil.
 *  May you find forgiveness for yourself and forgive others.
 *  May you share freely, never taking more than you give.
 */
?>
<?php include '../../common/view/header.html.php';?>
<?php
js::import($webRoot.'module/user/js/jquery.js');
js::import($webRoot.'module/user/js/zui.min.js');
js::import($webRoot.'module/user/js/zui.chart.min.js');?>
<style>
  .table-bordered td, .table-bordered th {
    border: 1px solid #989090 ! important;
  }
  .table>thead>tr>th{
    border: 1px solid #989090 ! important;
  }
  .panel{border: 1px solid #989090 ! important;}
  .yuef .caret{display: none;}
  .dropdown-toggle{cursor: pointer;}
  .dropdown-menu li a{cursor: pointer;}
</style>
<div class="panel">
  <div class="panel-heading text-center">
    <strong>
     <span style="position: relative">
          <a class="dropdown-toggle nian" style="color: #333" data-toggle="dropdown" data-years="<?php echo $time;?>"> <?php echo $time.'年';?></a>
          <ul class="dropdown-menu checknian">
            <?php foreach($years as $key=>$val):?>
              <?php if($key<=$nowyears):?>
                <li><a data-years="<?php echo $key?>"><?php echo $val;?></a></li>
              <?php endif?>
            <?php endforeach?>
          </ul>
          </span>
          <span style="position: relative">
             <a class="dropdown-toggle yuef" style="color: #333" data-toggle="dropdown" data-month="<?php echo $month?>"><?php echo $month.'月份';?> </a>
          <ul class="dropdown-menu checkmonth">
            <li><a data-month="<?php echo $startDate1;?>">01月份</a></li>
            <li><a data-month="<?php echo $startDate2;?>">02月份</a></li>
            <li><a data-month="<?php echo $startDate3;?>">03月份</a></li>
            <li><a data-month="<?php echo $startDate4;?>">04月份</a></li>
            <li><a data-month="<?php echo $startDate5;?>">05月份</a></li>
            <li><a data-month="<?php echo $startDate6;?>">06月份</a></li>
            <li><a data-month="<?php echo $startDate7;?>">07月份</a></li>
            <li><a data-month="<?php echo $startDate8;?>">08月份</a></li>
            <li><a data-month="<?php echo $startDate9;?>">09月份</a></li>
            <li><a data-month="<?php echo $startDate10;?>">10月份</a></li>
            <li><a data-month="<?php echo $startDate11;?>">11月份</a></li>
            <li><a data-month="<?php echo $startDate12;?>">12月份</a></li>
          </ul>
          </span>
      各单位警务监督考评情况统计表
    </strong>
  </div>
  <table class="table table-data table-bordered text-center table-fixedHeader">
    <thead>
    <tr class="text-center">
      <th rowspan="2">单位</th>
      <th colspan="<?php echo (count($category)+1);?>">扣分项目</th>
    </tr>
    <tr class="text-center">
      <th>小计</th>
      <?php foreach($category as $val) :?>
      <th><?php echo $val->mistake;?></th>
      <?php endforeach ?>
    </tr>
    </thead>
    <tbody>
    <?php foreach($unit as $uval):?>
    <tr>
      <td><?php echo $uval->unit_name;?></td>
      <td>
        <?php if($uval->scale):?>
          <?php echo html::a($this->createLink('statistics', 'punits', "unitid={$uval->unit_id}&start={$uval->startDate}&end={$uval->endDate}"),$uval->scale,"","data-toggle='modal' class='model'") ;?>
        <?php endif?>
      </td>
    <?php for($i=1;$i<=$uval->count;$i++):?>
      <td>
        <?php if($uval->$i):?>
            <?php $bid = 'bid'.$i;?>
          <?php echo html::a($this->createLink('statistics', 'cunits', "unitid={$uval->unit_id}&bid={$uval->$bid}&start={$uval->startDate}&end={$uval->endDate}"),$uval->$i,"","data-toggle='modal' class='model'") ;?>
          <?php endif?>
      </td>
          <?php endfor?>
    </tr>
    <?php endforeach?>

    </tbody></table>
</div>
<script>
  $('.checknian').find('li').find('a').click(function(){
    $('.nian').text($(this).text());
    $('.nian').attr("data-years",$(this).attr("data-years"));
  })

  $('.checkmonth').find('li').find('a').click(function(){
    var years = $('.nian').attr("data-years");
    var month = $(this).attr("data-month");
    $('.yuef').text($(this).text());
    $('.yuef').attr("data-month",$(this).attr("data-month"));
    var time = years+'-'+month;
    var url = "/index.php?m=statistics&f=units&starttime="+time;
    window.location.href =url;

  })


</script>
<?php include '../../common/view/footer.html.php';?>
